package com.jy.modules.cims.buyback.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.jy.modules.cims.data.common.dto.TCMmCreditDetailDTO;
import com.jy.modules.cims.data.dto.CreditDetailDto;

/**
 * 贷款回购查询、保存
 */
@Service("com.jy.modules.cims.buyback.service.BuyBackQueryService")
public class BuyBackQueryService extends BuyBackCommonService {

	/**
	 * 查询回购贷款明细  分页
	 */
	public List<TCMmCreditDetailDTO> getBuyBackDetailList(Map<String, Object> searchCreditParams, String redeemDate) throws Exception {
		//查询回购的贷款债权
		List<TCMmCreditDetailDTO> list = buyBackDao.searchBuyBackDetailByPaging(searchCreditParams);
		//调用4028接口得到赎回日债权价值
		if (list != null && list.size() > 0) {
			list = getBuyBackVal(list, redeemDate);
		}
		return list;
	}
	
	/**
	 * 根据批次号查询债权明细
	 * @param searchCreditParams
	 * @return
	 * @throws Exception
	 */
	public List<CreditDetailDto> getBuyBackDetailListByBatchId(Map<String, Object> searchCreditParams) throws Exception {
		//查询回购的贷款债权
		List<CreditDetailDto> list = buyBackDao.getBuyBackDetailListByBatchIdByPaging(searchCreditParams);
		return list;
	}
	
	/**
	 * 查询匹配的债权信息
	 * @param batchId
	 * @param transferId
	 * @return
	 */
	public List<CreditDetailDto> getMatchCreditList(Map<String, Object> searchCreditParams) {
		List<CreditDetailDto> list = buyBackDao.getMatchCreditListByPaging(searchCreditParams);
		return list;
	}


}
